package com.waiting.collection;

import java.util.*;

/**
 * @Description list去重
 * @Author bjweitingting
 * @Date 2018/10/31
 **/
public class ListRemoveDuplicate {
    public static void main(String[] args) {
        simpleType();
        stringType();
        String identifier = "waiting";
        Arrays.asList(identifier).stream().forEach(item -> System.out.println(item));
    }

    /**
     * 简单类型
     */
    public static void simpleType() {
        List<Integer> integers = new LinkedList<>();
        integers.add(1);
        integers.add(1);
        Set<Integer> set = new LinkedHashSet<>(integers);
        set.stream().forEach(integer -> System.out.println(integer));
    }

    /**
     * String类型
     */
    public static void stringType() {
        List<String> integers = new LinkedList<>();
        integers.add("test");
        integers.add("test");
        Set<String> set = new LinkedHashSet<>(integers);
        set.stream().forEach(integer -> System.out.println(integer));
    }

}

